package com.woniuxy.charin.mapper;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.charin.model.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.charin.model.vo.UserInfoVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;


/**
* @author KOO
* @description 针对表【user】的数据库操作Mapper
* @createDate 2024-12-25 17:24:20
* @Entity com.woniuxy.charin.model.entity.User
*/
public interface UserMapper extends BaseMapper<User> {

    // 自定义分页查询方法
    Page<UserInfoVo> selectUsersWithRoles(Page<UserInfoVo> page,
                                          @Param("account") String account,
                                          @Param("roleId") String roleId,
                                          @Param("status") Integer status);


    //批量修改状态
    @Update({
            "<script>",
            "UPDATE user",
            "SET status = #{status}",
            "WHERE id IN (",
            "<foreach collection='deleteIds' item='id'  separator=','>",
            "#{id}",
            "</foreach> )",
            "</script>"
    })
    void batchUpdateStatus(@Param("deleteIds") Integer[] deleteIds,
                    @Param("status") Integer status);
}




